<%--
  Created by IntelliJ IDEA.
  User: 左
  Date: 2024/12/26
  Time: 22:19
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
    String contextPath=request.getContextPath();
    Integer pages = 1;
%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>Title</title>
    <style>
        body, html {
            margin: 0;
            padding: 0;
            font-family: Arial, sans-serif;
        }
        .header1 {
            background-color: #007BFF;
            color: white;
            padding: 10px;
            text-align: center;
        }
        .sidebar {
            width: 200px;
            background-color: #f8f9fa;
            float: left;
            height: 100vh;
            padding-top: 20px;
        }
        .sidebar a {
            display: block;
            padding: 10px;
            text-decoration: none;
            color: black;
        }
        .sidebar a:hover {
            background-color: #ddd;
        }
        .content {
            margin-left: 210px;
            padding: 20px;
        }
        table{
            border-collapse: collapse;
            width:80%;
            float:right;
        }
        .pagediv{
            float:right;
        }
        th,td{
            border:1px solid black;
            padding:8px;
            text-align:center;
        }
        .btn-add{
            display: inline-block;
            padding:8px 15px;
            margin:10px;
            font-size:16px;
            font-weight: bold;
            text-align: center;
            text-decoration: none;
            color:white;
            background-color: cornflowerblue;
            border: none;
            border-radius: 5px;
            cursor: pointer;
            transition: background-color 0.3s;
        }
        .btn-add:hover,
        .btn-update:hover,
        .btn-delete:hover
        {
            background-color: lightblue;
        }
        .btn-update{
            display: inline-block;
            padding:5px 10px;
            margin:10px;
            font-size:16px;
            font-weight: bold;
            text-align: center;
            text-decoration: none;
            color:white;
            background-color: green;
            border: none;
            border-radius: 5px;
            cursor: pointer;
            transition: background-color 0.3s;
        }
        .btn-delete{
            display: inline-block;
            padding:5px 10px;
            margin:10px;
            font-size:16px;
            font-weight: bold;
            text-align: center;
            text-decoration: none;
            color:white;
            background-color: red;
            border: none;
            border-radius: 5px;
            cursor: pointer;
            transition: background-color 0.3s;
        }
        .rightdiv{
            float: right;
        }
    </style>
</head>
<body>
<jsp:include page="/nav.jsp"/>
<div class="content">
<div>
    <h3>学生管理</h3>
</div>
    <form action="studentlist" method="post">
    <div>
        <a href="studentadd" class="btn-add">添加学生</a>
        <div class="rightdiv">
        <select name="buildingcards" id="Building_card">
            <option value="">全部宿舍楼</option>
                <c:forEach items="${builds}" var="b">
                    <option value="${b.buildingCard}">${b.buildingCard}</option>
                </c:forEach>
        </select>
        <select id="stunames" name="selectors">
            <option value="0" name="message">搜索信息</option>
            <option value="1" name="student_names">姓名</option>
            <option value="2" name="student_sex">性别</option>
            <option value="3" name="student_room">寝室号</option>
        </select>
        <input type="text" name="select_content" >
        <input type="submit" name="reacher" value="搜索" >
        </div>
    </div>
    </form>
<table>
    <tbody>
    <tr>
        <th>学号</th>
        <th>姓名</th>
        <th>性别</th>
        <th>密码</th>
        <th>联系方式</th>
        <th>宿舍楼号</th>
        <th>寝室编号</th>
        <th>操作</th>
    </tr>
    <c:forEach var="i" items="${studentlist}">
        <tr>
            <td>${i.stucode}</td>
            <td>${i.name}</td>
            <td>${i.gender}</td>
            <td>${i.password}</td>
            <td>${i.phone}</td>
            <td>${i.buildings_card}</td>
            <td>${i.rooms_card}</td>
            <td>
                <a href="<%=contextPath%>/studentupdate?id=${i.stucode}&name=${i.name}" class="btn-update" >修改</a>
                <a href="<%=contextPath%>/studentdelete?id=${i.stucode}" class="btn-delete">删除</a>
            </td>
        </tr>
    </c:forEach>
    </tbody>
    <div class="pagediv">
        <a type="button" href="<%=contextPath%>/studentpage?incr=-1">上一页</a>
        <span>当前第${stu_pages == null ? 1 : stu_pages}页</span>
        <a type="button" href="<%=contextPath%>/studentpage?incr=1">下一页</a>
    </div>
</table>
</body>
</html>
